﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataAccess;
namespace SQT.tracnghiem.Ajax.ASP.Staff
{
    public partial class edit_info : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string name = Request.QueryString["name"];
            string email = Request.QueryString["email"];
            string birthday = Request.QueryString["birthday"];
            string phone = Request.QueryString["phone"];
            string city = Request.QueryString["city"];
            int? add = null;
            int sex = int.Parse(Request.QueryString["sex"]);

            bool check_sex = true;
            if(sex == 0 )
                check_sex= false;
            if (city != "")
            {
                add = int.Parse(city);
            }
            int id = int.Parse(Session["admin_id"].ToString());

            var get_staff = new TblManagerController().FetchAll().Where(x => x.ManagerId == id).Single();

            new TblManagerController().Update(id, get_staff.ManagerName, get_staff.ManagerPass, get_staff.Role, name, DateTime.Parse(birthday), check_sex, get_staff.Avatar,get_staff.Captain,phone, email, get_staff.Facebook, add, get_staff.Active,get_staff.Wallpaper, get_staff.Note);
        }
    }
}